package com.awonsome.mall.pms.pojo.vo;

import com.awonsome.common.core.base.BaseVO;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

import java.util.Objects;

/**
 * @author yangdejun
 * @date 2022/1/30 22:21
 */
@Builder
public class OrderItemVO extends BaseVO {

    @Getter
    @Setter
    private Long skuId;

    @Getter
    @Setter
    private String skuImg;

    @Getter
    @Setter
    private String title;

    @Getter
    @Setter
    private Integer number;

    @Getter
    @Setter
    private Long price;

    @Getter
    @Setter
    private Long coupon = 0L;

    @Setter
    private Long subTotal;

    public Long getSubTotal() {
        Long total = 0L;
        if (Objects.nonNull(price) && Objects.nonNull(number)) {
            total = price * number;
        }
        return total;
    }

}